import request from '@/utils/request'

// 获取帖子列表
export function listPost(params) {
	return request({
		url: '/bbs/post/list',
		method: 'get',
		params
	})
}
// 新增帖子
export function addPost(data) {
	return request({
		url: '/app/bbs/post',
		method: 'post',
		data: data
	})
}

// 点赞帖子
export function likePost(postId) {
	return request({
		url: `/app/bbs/like/${postId}`,
		method: 'post'
	})
}

// 取消点赞
export function cancelLike(postId) {
	return request({
		url: `/app/bbs/like/${postId}`,
		method: 'delete'
	})
}
// 获取评论列表
export function listComment(params) {
	return request({
		url: '/bbs/comment/list',
		method: 'get',
		params
	})
}

// 添加评论
export function addComment(data) {
	return request({
		url: '/bbs/comment',
		method: 'post',
		data
	})
}

// 分享帖子
export function sharePost(postId) {
	return request({
		url: `/bbs/post/share/${postId}`,
		method: 'post'
	})
}